package com.wn.equipment.config;

import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhairenhao
 * @date 2022/10/24 15:51
 */
@Configuration
public class OssClientConfig {
    //填写Bucket所在地域对应的Endpoint。
    @Value("${aliyun.oss.endpoint}")
    String endpoint ;
    // 阿里云账号AccessKey拥有所有API的访问权限
    @Value("${aliyun.oss.accessKeyId}")
    String accessKeyId ;
    @Value("${aliyun.oss.accessKeySecret}")
    String accessKeySecret;

    @Bean
    public OSSClient createOssClient() {
        return (OSSClient)new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }
}
